

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 查看地面站预订
<a name="locations.reservations"></a>

 您可以使用 API 查看地面站天线上的预留情况。[ListGroundStationReservations](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_ListGroundStationReservations.html)预约代表天线上的时间段，包括您的预定联系人。 [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>

 以下示例列出了未来 7 天使用适用于 Python 的 AWS SDK (Boto3) 在地面站进行的预订，包括按预留类型进行筛选。

```
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']}"
        )
```