Skip to content

Commit

Permalink
Move Astro to main (Azure#25934)
Browse files Browse the repository at this point in the history
Co-authored-by: azure-powershell-bot <[email protected]>
  • Loading branch information
1 parent 837c0f5 commit 197c61c
Show file tree
Hide file tree
Showing 21 changed files with 2,201 additions and 288 deletions.
10 changes: 9 additions & 1 deletion src/Astro/Astro.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ module-version: 0.1.0
# Normally, title is the service name
title: Astro
subject-prefix: $(service-name)
#this resource cannot be updated by Get-Put operation, so revoke the MSI type upgrade
# Disable transform IdentityType as GET+PUT can not replace patch
# 1. Organizations_CreateOrUpdate can not update resources
# 2. the input schemas of PUT and PATCH are different
disable-transform-identity-type: true

directive:
Expand All @@ -66,4 +68,10 @@ directive:
- where:
verb: Set
remove: true
- where:
verb: New
hide: true
- where:
verb: Update
hide: true
```
311 changes: 311 additions & 0 deletions src/Astro/Astro.Autorest/custom/New-AzAstroOrganization.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@

# ----------------------------------------------------------------------------------
# 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 OrganizationResource
.Description
Create a OrganizationResource
.Example
New-AzAstroOrganization -Name UT.7.test -ResourceGroupName astro-user -Location eastus -MarketplaceSubscriptionId 11111111-2222-3333-4444-123456789101 -OfferDetailOfferId astro -OfferDetailPlanId astro-paygo -OfferDetailPublisherId astronomer1 -OfferDetailPlanName 'Monthly Pay-As-You-Go' -OfferDetailTermId abcdefghijkl -OfferDetailTermUnit Monthly -UserEmailAddress [email protected] -UserFirstName user -UserLastName test -UserUpn [email protected] -PartnerOrganizationPropertyWorkspaceName aaa -PartnerOrganizationPropertyOrganizationName bbb -SingleSignOnPropertyAadDomain MicrosoftCustomerLed.onmicrosoft.com
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.IOrganizationResource
.Link
https://learn.microsoft.com/powershell/module/az.astro/new-azastroorganization
#>
function New-AzAstroOrganization {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.IOrganizationResource])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(Mandatory)]
[Alias('OrganizationName')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Path')]
[System.String]
# Name of the Organizations resource
${Name},

[Parameter(Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Path')]
[System.String]
# The name of the resource group.
# The name is case insensitive.
${ResourceGroupName},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
[System.String]
# The ID of the target subscription.
${SubscriptionId},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# The geo-location where the resource lives
${Location},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Azure subscription id for the the marketplace offer is purchased from
${MarketplaceSubscriptionId},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Offer Id for the marketplace offer
${OfferDetailOfferId},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Plan Id for the marketplace offer
${OfferDetailPlanId},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Publisher Id for the marketplace offer
${OfferDetailPublisherId},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Email address of the user
${UserEmailAddress},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# First name of the user
${UserFirstName},

[Parameter(ParameterSetName = 'CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Last name of the user
${UserLastName},

[Parameter(ParameterSetName='CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.Management.Automation.SwitchParameter]
# Decides if enable a system assigned identity for the resource.
${EnableSystemAssignedIdentity},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.PSArgumentCompleterAttribute("PendingFulfillmentStart", "Subscribed", "Suspended", "Unsubscribed")]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Marketplace subscription status
${MarketplaceSubscriptionStatus},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Plan Name for the marketplace offer
${OfferDetailPlanName},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Plan Display Name for the marketplace offer
${OfferDetailTermId},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Plan Display Name for the marketplace offer
${OfferDetailTermUnit},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Organization Id in partner's system
${PartnerOrganizationPropertyOrganizationId},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Organization name in partner's system
${PartnerOrganizationPropertyOrganizationName},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Workspace Id in partner's system
${PartnerOrganizationPropertyWorkspaceId},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Workspace name in partner's system
${PartnerOrganizationPropertyWorkspaceName},

[Parameter(ParameterSetName = 'CreateExpanded')]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String[]]
# List of AAD domains fetched from Microsoft Graph for user.
${SingleSignOnPropertyAadDomain},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# AAD enterprise application Id used to setup SSO
${SingleSignOnPropertyEnterpriseAppId},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.PSArgumentCompleterAttribute("Initial", "Enable", "Disable")]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# State of the Single Sign On for the organization
${SingleSignOnPropertySingleSignOnState},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# URL for SSO to be used by the partner to redirect the user to their system
${SingleSignOnPropertySingleSignOnUrl},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.ITrackedResourceTags]))]
[System.Collections.Hashtable]
# Resource tags.
${Tag},

[Parameter(ParameterSetName = 'CreateExpanded')]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String[]]
# The array of user assigned identities associated with the resource.
# The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'
${UserAssignedIdentity},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# User's phone number
${UserPhoneNumber},

[Parameter(ParameterSetName = 'CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# User's principal name
${UserUpn},

[Parameter(ParameterSetName = 'CreateViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Path of Json file supplied to the Create operation
${JsonFilePath},

[Parameter(ParameterSetName = 'CreateViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
[System.String]
# Json string supplied to the Create operation
${JsonString},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.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.Astro.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command as a job
${AsJob},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command asynchronously
${NoWait},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)

process {
if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') -or $PSBoundParameters.ContainsKey('UserAssignedIdentity') ){
$supportsSystemAssignedIdentity = $PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')
$supportsUserAssignedIdentity = $PSBoundParameters.ContainsKey("UserAssignedIdentity") -and $UserAssignedIdentity.Length -gt 0

# calculate IdentityType
if (($supportsSystemAssignedIdentity -and $supportsUserAssignedIdentity)) {
$PSBoundParameters.Add("IdentityType", "SystemAssigned,UserAssigned")
}
elseif ($supportsUserAssignedIdentity -and (-not $supportsSystemAssignedIdentity)) {
$PSBoundParameters.Add("IdentityType", "UserAssigned")
}
elseif ((-not $supportsUserAssignedIdentity) -and $supportsSystemAssignedIdentity) {
$PSBoundParameters.Add("IdentityType", "SystemAssigned")
}
else {
$PSBoundParameters.Add("IdentityType", "None")
}

# remove EnableSystemAssignedIdentity
if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) {
$null = $PSBoundParameters.Remove("EnableSystemAssignedIdentity")
}
}
Az.Astro.internal\New-AzAstroOrganization @PSBoundParameters
}

}
Loading

0 comments on commit 197c61c

Please sign in to comment.