Azure / Azure/azure-rest-api-specs-examples
[Sample Issue] UpdateExpressRouteCrossConnection
- Dominant language
- No language data
- Stars
- 40
- Forks
- 23
- Avg merge
- 23h 36m
- Merged PRs (30d)
- 172
Description
### Link to sample
https://learn.microsoft.com/en-us/rest/api/expressroute/express-route-cross-connections/create-or-update?view=rest-expressroute-2024-05-01&tabs=Python#request-body
### Library name and version
azure-mgmt-network 28.1.0
### Language of the Sample
- [ ] C#/.NET
- [ ] Java
- [ ] JavaScript/TypedScript
- [x] Python
- [ ] Golang
- [ ] Other - Please specify in Issue details field
### Sample Issue Type
- [x] Sample not working
- [ ] Sample missing
- [ ] Do not understand sample
### Issue details
Using the code provided in the documentation:
```
response = client.express_route_cross_connections.begin_create_or_update(
resource_group_name="CrossConnection-SiliconValley",
cross_connection_name="",
parameters={"properties": {"serviceProviderProvisioningState": "NotProvisioned"}},
).result()
```
results in the following error:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (LocationRequired) The location property is required for this definition.
Code: LocationRequired
Message: The location property is required for this definition.
Turns out the code needs "location" and expressRouteCircuit parameters to work correctly, so a working example would look like this:
```
response = client.express_route_cross_connections.begin_create_or_update(
resource_group_name="CrossConnection-SiliconValley",
cross_connection_name="",
parameters={"serviceProviderProvisioningState": "NotProvisioned",
"location": expressroute.location,
"expressRouteCircuit": {
"id": expressroute.express_route_circuit.id
}},
).result()
```
where expressroute is the ExpressRouteCrossConnect object being updated as returned from express_route_cross_connections.get() method
### Expected behavior
expected behavior is for the example code to work (ie, not return any errors from the API) and result in the serviceProviderProvisioningState being updated to the given value.
### Actual behavior
throws an error:
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (LocationRequired) The location property is required for this definition.
Code: LocationRequired
Message: The location property is required for this definition.
### Reproduction Steps
1. copy and paste the python code sample provided in the documentation
2. run it
3. see it return an error
### Environment
python 3.12 running on Linux
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.