Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset fields #63

Open
tigpas opened this issue Sep 1, 2024 · 0 comments
Open

Unset fields #63

tigpas opened this issue Sep 1, 2024 · 0 comments

Comments

@tigpas
Copy link

tigpas commented Sep 1, 2024

Hi,

I whould like to unset fields.

Example: I created a new object

New-NetboxIPAMAddress -Address 192.0.2.0/24 -Status active

id                   : 1
url                  : https://192.168.16.135/api/ipam/ip-addresses/1/
display              : 192.0.2.0/24
family               : @{value=4; label=IPv4}
address              : 192.0.2.0/24
vrf                  :
tenant               :
status               : @{value=active; label=Active}
role                 :
assigned_object_type :
assigned_object_id   :
assigned_object      :
nat_inside           :
nat_outside          : {}
dns_name             :
description          :
comments             :
tags                 : {}
custom_fields        :
created              : 01/09/2024 17:20:01
last_updated         : 01/09/2024 17:20:01

I added a tenant to this object

set-NetboxIPAMAddress -id 1 -Tenant 1

id                   : 1
url                  : https://192.168.16.135/api/ipam/ip-addresses/1/
display              : 192.0.2.0/24
family               : @{value=4; label=IPv4}
address              : 192.0.2.0/24
vrf                  :
tenant               : @{id=1; url=https://192.168.16.135/api/tenancy/tenants/1/; display=test; name=test; slug=test;
                       description=}
status               : @{value=active; label=Active}
role                 :
assigned_object_type :
assigned_object_id   :
assigned_object      :
nat_inside           :
nat_outside          : {}
dns_name             :
description          :
comments             :
tags                 : {}
custom_fields        :
created              : 01/09/2024 17:20:01
last_updated         : 01/09/2024 17:21:26

Now, I whould like to remove the tenant.

set-NetboxIPAMAddress -id 1 -Tenant ""
Invoke-RestMethod:  {   "tenant": [     "Related object not found using the provided numeric ID: 0"   ] }
InvalidOperation: You cannot call a method on a null-valued expression.

set-NetboxIPAMAddress -id 1 -Tenant 0
Invoke-RestMethod:  {   "tenant": [     "Related object not found using the provided numeric ID: 0"   ] }
InvalidOperation: You cannot call a method on a null-valued expression.

set-NetboxIPAMAddress -id 1 -Tenant
Set-NetboxIPAMAddress: Missing an argument for parameter 'Tenant'. Specify a parameter of type 'System.UInt64' and try again.

set-NetboxIPAMAddress -id 1 -Tenant NULL
Set-NetboxIPAMAddress: Cannot process argument transformation on parameter 'Tenant'. Cannot convert value "NULL" to type "System.UInt64". Error: "The input string 'NULL' was not in a correct format."

set-NetboxIPAMAddress -id 1 -Tenant $null
Invoke-RestMethod:  {   "tenant": [     "Related object not found using the provided numeric ID: 0"   ] }
InvalidOperation: You cannot call a method on a null-valued expression.

set-NetboxIPAMAddress -id 1 -Tenant unset
Set-NetboxIPAMAddress: Cannot process argument transformation on parameter 'Tenant'. Cannot convert value "unset" to type "System.UInt64". Error: "The input string 'unset' was not in a correct format."

Have you an idea for a solution? Maybe a code example can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant