aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 77 forks source link

Get-EC2FlowLog filter issue #249

Closed esxi1979 closed 2 years ago

esxi1979 commented 2 years ago

Description

Is this cmdlet to check VPC flowlog status ?

if yes i tried below

PS /root> Get-EC2FlowLog -Filter @{Name="resource-id ";Value="vpc-dxxx"}

Get-EC2FlowLog: Cannot bind parameter 'Filter'. Cannot create object of type "Amazon.EC2.Model.Filter". The Value property was not found for the Amazon.EC2.Model.Filter object. The available property is: [Name ] , [Values <System.Collections.Generic.List`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]>] PS /root>

Google search do not give any clue. Pls suggest , thanks

Reproduction Steps

Pls see above

Logs

Pls see above

Environment

CentOS 7

PS /root> Get-AWSPowerShellVersion

AWS Tools for PowerShell Version 4.1.29.0 Copyright 2012-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Amazon Web Services SDK for .NET Core Runtime Version 3.7.8.1 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://github.com/aws/aws-tools-for-powershell/blob/master/CHANGELOG.md

This software includes third party software subject to the following copyrights:

Resolution

NA


This is a :bug: bug-report

ashishdhingra commented 2 years ago

Hi @esxi1979,

Good morning.

The Filter object expects a List of values in Values property. Kindly refer service API documentation at https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html and AWS PowerShell documentation at https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/EC2/TFilter.html. For your scenario, Get-EC2FlowLog needs to have -Filter as shown below:

Get-EC2FlowLog -Filter @{Name="resource-id";Values="vpc-dxxx"}

For passing multiple values for Values property, you could use something like below:

Get-EC2FlowLog -Filter @{Name="resource-id";Values="vpc-dxxx","vpc-dxyz"}

Hope this helps. Closing this issue as guidance.

Thanks, Ashish

github-actions[bot] commented 2 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

esxi1979 commented 2 years ago

@ashishdhingra

Thanks for the response. I think you overlooked my message , i did what you suggesting to start with & got the error & hence i raise this bug, pls check

PS /root> Get-EC2FlowLog -Filter @{Name="resource-id ";Value="vpc-dxxx"}

Get-EC2FlowLog: Cannot bind parameter 'Filter'. Cannot create object of type "Amazon.EC2.Model.Filter". The Value property was not found for the Amazon.EC2.Model.Filter object. The available property is: [Name ] , [Values <System.Collections.Generic.List`1[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]>] PS /root>

image

ashishdhingra commented 2 years ago

@esxi1979 From the screenshot it appears that you are still using the incorrect property name Value. Please review my comment, you need to use Values (notice extra s at the end).

esxi1979 commented 2 years ago

@ashishdhingra Thank You.