Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ INPUTOBJECT <IResourceGraphIdentity>: Identity Parameter

PROPERTY <IGraphQueryResource>: Graph Query entity definition.
Query <String>: KQL query that will be graph.
[ETag <String>]: This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.
[Location <String>]: The location of the resource
[Tag <IResourceTags>]: Resource tags
[(Any) <String>]: This indicates any property can be added to this object.
Expand Down Expand Up @@ -83,13 +82,6 @@ param(
# The description of a graph query.
${Description},

[Parameter(ParameterSetName='CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.ResourceGraph.Category('Body')]
[System.String]
# This will be used to handle Optimistic Concurrency.
# If not present, it will always overwrite the existing resource without checking conflict.
${ETag},

[Parameter(ParameterSetName='CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.ResourceGraph.Category('Body')]
[System.String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ To create the parameters described below, construct a hash table containing the

BODY <IGraphQueryUpdateParameters>: The parameters that can be provided when updating workbook properties properties.
[Description <String>]: The description of a graph query.
[ETag <String>]: This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without checking conflict.
[Query <String>]: KQL query that will be graph.
[Tag <IGraphQueryUpdateParametersTags>]: Resource tags
[(Any) <String>]: This indicates any property can be added to this object.
Expand Down Expand Up @@ -90,14 +89,6 @@ param(
# The description of a graph query.
${Description},

[Parameter(ParameterSetName='UpdateExpanded')]
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.ResourceGraph.Category('Body')]
[System.String]
# This will be used to handle Optimistic Concurrency.
# If not present, it will always overwrite the existing resource without checking conflict.
${ETag},

[Parameter(ParameterSetName='UpdateExpanded')]
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.ResourceGraph.Category('Body')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Get a single graph query by its resourceName.
```powershell
PS C:\> Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global SharedQuery-t01 microsoft.resourcegraph/queries
```

Expand All @@ -50,8 +50,8 @@ This command gets all resource graph query under a resource group.
```powershell
PS C:\> Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name SharedQuery-t01

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global SharedQuery-t01 microsoft.resourcegraph/queries
```

Expand All @@ -62,8 +62,8 @@ This command gets a resource graph query by name.
PS C:\> $query = New-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t03 -Location 'global' -Query 'project id, name, type, location' -Description 'test'
PS C:\> Get-AzResourceGraphQuery -InputObject $query

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global SharedQuery-t01 microsoft.resourcegraph/queries
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Create a new graph query.

```
New-AzResourceGraphQuery -Name <String> -ResourceGroupName <String> [-SubscriptionId <String>]
[-Description <String>] [-ETag <String>] [-File <String>] [-Location <String>] [-Query <String>]
[-Tag <Hashtable>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
[-Description <String>] [-File <String>] [-Location <String>] [-Query <String>] [-Tag <Hashtable>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -28,8 +28,8 @@ Create a new graph query.
PS C:\> New-AzResourceGraphQuery -Name query-t03 -ResourceGroupName azure-rg-test -Location "global" -Description "requesting a subset of resource fields." -Query "project id, name, type, location, tags"


ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t03 microsoft.resourcegraph/queries
```

Expand All @@ -39,8 +39,8 @@ This command creates a resource graph query by the query parameter.
```powershell
PS C:\> New-AzResourceGraphQuery -Name query-t04 -ResourceGroupName azure-rg-test -Location "global" -Description "requesting a subset of resource fields." -File 'D:\azure-service\ResourceGraph.Autorest\azure-powershell\src\ResourceGraph\ResourceGraph.Autorest\test\Query.kql'

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t04 microsoft.resourcegraph/queries
```

Expand Down Expand Up @@ -78,22 +78,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ETag
This will be used to handle Optimistic Concurrency.
If not present, it will always overwrite the existing resource without checking conflict.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -File
The content of the file will be passed to the query parameter.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ Updates a graph query that has already been added.
### UpdateExpanded (Default)
```
Update-AzResourceGraphQuery -Name <String> -ResourceGroupName <String> [-SubscriptionId <String>]
[-Description <String>] [-ETag <String>] [-File <String>] [-Query <String>] [-Tag <Hashtable>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
[-Description <String>] [-File <String>] [-Query <String>] [-Tag <Hashtable>] [-DefaultProfile <PSObject>]
[-Confirm] [-WhatIf] [<CommonParameters>]
```

### UpdateViaIdentityExpanded
```
Update-AzResourceGraphQuery -InputObject <IResourceGraphIdentity> [-Description <String>] [-ETag <String>]
[-File <String>] [-Query <String>] [-Tag <Hashtable>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf]
[<CommonParameters>]
Update-AzResourceGraphQuery -InputObject <IResourceGraphIdentity> [-Description <String>] [-File <String>]
[-Query <String>] [-Tag <Hashtable>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -33,22 +32,22 @@ Updates a graph query that has already been added.

### Example 1: Update the parameter query and tag by name
```powershell
PS C:\> Update-AzResourceGraphQuery -ResourceGroupName lucas-rg-test -Name query-t05 -Query "project id, name, type, location, tags" -Tag @{'key1'=1;'key2'=2}
PS C:\> Update-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t05 -Query "project id, name, type, location, tags" -Tag @{'key1'=1;'key2'=2}

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t05 microsoft.resourcegraph/queries
```

This command updates the parameter query and tag by name.

### Example 2: Update the parameter file by object
```powershell
PS C:\> $query = Get-AzResourceGraphQuery -ResourceGroupName lucas-rg-test -Name query-t05
PS C:\> $query = Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t05
PS C:\> Update-AzResourceGraphQuery -InputObject $query -File './Query.kql'

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t05 microsoft.resourcegraph/queries
```

Expand Down Expand Up @@ -86,22 +85,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ETag
This will be used to handle Optimistic Concurrency.
If not present, it will always overwrite the existing resource without checking conflict.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -File
The content of the file will be passed to the query parameter.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
```powershell
PS C:\> Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global SharedQuery-t01 microsoft.resourcegraph/queries
```

Expand All @@ -13,8 +13,8 @@ This command gets all resource graph query under a resource group.
```powershell
PS C:\> Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name SharedQuery-t01

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global SharedQuery-t01 microsoft.resourcegraph/queries
```

Expand All @@ -25,8 +25,8 @@ This command gets a resource graph query by name.
PS C:\> $query = New-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t03 -Location 'global' -Query 'project id, name, type, location' -Description 'test'
PS C:\> Get-AzResourceGraphQuery -InputObject $query

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global SharedQuery-t01 microsoft.resourcegraph/queries
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
PS C:\> New-AzResourceGraphQuery -Name query-t03 -ResourceGroupName azure-rg-test -Location "global" -Description "requesting a subset of resource fields." -Query "project id, name, type, location, tags"


ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t03 microsoft.resourcegraph/queries
```

Expand All @@ -14,8 +14,8 @@ This command creates a resource graph query by the query parameter.
```powershell
PS C:\> New-AzResourceGraphQuery -Name query-t04 -ResourceGroupName azure-rg-test -Location "global" -Description "requesting a subset of resource fields." -File 'D:\azure-service\ResourceGraph.Autorest\azure-powershell\src\ResourceGraph\ResourceGraph.Autorest\test\Query.kql'

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t04 microsoft.resourcegraph/queries
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
### Example 1: Update the parameter query and tag by name
```powershell
PS C:\> Update-AzResourceGraphQuery -ResourceGroupName lucas-rg-test -Name query-t05 -Query "project id, name, type, location, tags" -Tag @{'key1'=1;'key2'=2}
PS C:\> Update-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t05 -Query "project id, name, type, location, tags" -Tag @{'key1'=1;'key2'=2}

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t05 microsoft.resourcegraph/queries
```

This command updates the parameter query and tag by name.

### Example 2: Update the parameter file by object
```powershell
PS C:\> $query = Get-AzResourceGraphQuery -ResourceGroupName lucas-rg-test -Name query-t05
PS C:\> $query = Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t05
PS C:\> Update-AzResourceGraphQuery -InputObject $query -File './Query.kql'

ETag Location Name Type
---- -------- ---- ----
Location Name Type
-------- ---- ----
global query-t05 microsoft.resourcegraph/queries
```

Expand Down
8 changes: 8 additions & 0 deletions src/ResourceGraph/ResourceGraph.Autorest/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ directive:
- from: swagger-document
where: $
transform: return $.replace(/\/subscriptions\/\{subscriptionId\}\/resourceGroups\/\{resourceGroupName\}\/providers\/Microsoft\.ResourceGraph\/queries\/\{resourceName\}/g, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.resourcegraph/queries/{resourceName}")
## Remove Etag
- from: swagger-document
where: $.definitions.Resource.properties
transform: delete $.eTag
## Remove Etag
- from: swagger-document
where: $.definitions.GraphQueryUpdateParameters.properties
transform: delete $.eTag
- where:
verb: Set
subject: Query$
Expand Down