

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 檢視地面站點保留
<a name="locations.reservations"></a>

 您可以使用 [ListGroundStationReservations](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_ListGroundStationReservations.html) API，在地面工作站檢視跨天線的保留。預留代表天線上的時間區塊，包括您的排程聯絡人。 [AWS Ground Station 專用天線](dedicated-antennas.md) 客戶也會看到維護時段。

 此資訊可協助您了解規劃聯絡排程時的天線可用性，並讓您了解地面工作站天線上發生的情況。

## 列出保留
<a name="locations.reservations.listing"></a>

 若要列出保留，請呼叫 [ListGroundStationReservations](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_ListGroundStationReservations.html)，其中包含地面工作站識別符和時間範圍。API 會在指定的時段內，傳回地面工作站所有天線的保留。

 您看到的保留取決於您的存取層級：
+  **公有 AWS Ground Station 客戶** — 您只能看到自己的聯絡人保留。不包含其他帳戶擁有的維護時段和聯絡人。
+  **AWS Ground Station 專用天線客戶** — 您可以在專用天線上查看所有保留，包括維護時段和其他帳戶排程的聯絡人。僅包含您擁有的聯絡人的聯絡人識別符。如需詳細資訊，請參閱[AWS Ground Station 專用天線](dedicated-antennas.md)。

## 保留類型
<a name="locations.reservations.types"></a>

每個保留都有一個類型，指出天線時間的用途：
+  **聯絡人** — 聯絡人保留代表為衛星通訊預留的天線時間。保留開始和結束時間反映完整的天線保留，包括傳遞前和傳遞後時間，而不只是衛星傳遞時段。
+  **維護** — 維護保留代表天線因維護而無法使用的期間。維護保留包括`maintenanceType`指出維護是計劃還是計劃外的 。

## 程式碼範例
<a name="locations.reservations.examples"></a>

 下列範例使用適用於 Python 的 AWS SDK (Boto3) 列出未來 7 天的地面站點保留，包括依保留類型篩選。

```
import boto3
from datetime import datetime, timezone, timedelta

# Create AWS Ground Station client
ground_station_client = boto3.client("groundstation")

# The ground station ID to list reservations for
ground_station_id = "Ohio 1"

# Define the time range to query. Reservations include both your
# scheduled contacts and maintenance windows at the ground station.
start_time = datetime.now(timezone.utc)
end_time = start_time + timedelta(days=7)

# List all reservations at a ground station for the next 7 days.
# You can filter by reservation type to see only contacts or
# only maintenance windows.
print(f"Listing reservations for ground station '{ground_station_id}'...")
print(f"Time range: {start_time} to {end_time}")

paginator = ground_station_client.get_paginator("list_ground_station_reservations")
page_iterator = paginator.paginate(
    groundStationId=ground_station_id,
    startTime=start_time,
    endTime=end_time,
    PaginationConfig={
        "MaxItems": 100,
        "PageSize": 20,
    },
)

for page in page_iterator:
    for reservation in page["reservationList"]:
        reservation_type = reservation["reservationType"]
        antenna_name = reservation["antennaName"]
        res_start = reservation["startTime"]
        res_end = reservation["endTime"]

        print(f"  Type: {reservation_type}")
        print(f"    Antenna: {antenna_name}")
        print(f"    Start: {res_start}")
        print(f"    End: {res_end}")

        details = reservation["reservationDetails"]
        if "contact" in details:
            contact_id = details["contact"].get("contactId", "N/A")
            print(f"    Contact ID: {contact_id}")
        elif "maintenance" in details:
            maintenance_type = details["maintenance"]["maintenanceType"]
            print(f"    Maintenance Type: {maintenance_type}")

        print()

# For Dedicated Antenna customers, you can also filter to show only maintenance windows
print("Listing only maintenance reservations...")

page_iterator = paginator.paginate(
    groundStationId=ground_station_id,
    startTime=start_time,
    endTime=end_time,
    reservationTypes=["MAINTENANCE"],
    PaginationConfig={
        "MaxItems": 100,
        "PageSize": 20,
    },
)

for page in page_iterator:
    for reservation in page["reservationList"]:
        maintenance_type = reservation["reservationDetails"]["maintenance"][
            "maintenanceType"
        ]
        print(
            f"  {maintenance_type} maintenance on {reservation['antennaName']}: "
            f"{reservation['startTime']} to {reservation['endTime']}"
        )
```