{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-s3/json-schema/amazon-s3-put-bucket-metrics-configuration-request-schema.json",
  "title": "PutBucketMetricsConfigurationRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-s3-metrics-api-openapi.yml#/components/schemas/PutBucketMetricsConfigurationRequest",
  "type": "object",
  "properties": {
    "Bucket": {
      "type": "string",
      "description": "The name of the bucket for which the metrics configuration is set. Directory buckets - When you use this operation with a directory bucket, you must use path-style requests in the format https://s3express-control.region-code.amazonaws.com/bucket-name . Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format bucket-base-name--zone-id--x-s3 (for example, DOC-EXAMPLE-BUCKET--usw2-az1--x-s3). For information about bucket naming restrictions, see Directory bucket naming rules"
    },
    "Id": {
      "type": "string",
      "description": "The ID used to identify the metrics configuration. The ID has a 64 character limit and can only contain letters, numbers, periods, dashes, and underscores."
    },
    "MetricsConfiguration": {
      "$ref": "#/$defs/MetricsConfiguration"
    },
    "ExpectedBucketOwner": {
      "type": "string",
      "description": "The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied). For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code 501 Not Implemented."
    }
  },
  "required": [
    "Bucket",
    "Id",
    "MetricsConfiguration"
  ],
  "$defs": {
    "MetricsAndOperator": {
      "type": "object",
      "properties": {
        "Prefix": {
          "type": "string",
          "description": "The prefix used when evaluating an AND predicate."
        },
        "Tags": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Tag"
          },
          "description": "The list of tags used when evaluating an AND predicate. Tag filters are not supported for directory buckets."
        },
        "AccessPointArn": {
          "type": "string",
          "description": "The access point ARN used when evaluating an AND predicate."
        }
      }
    },
    "MetricsConfiguration": {
      "type": "object",
      "properties": {
        "Id": {
          "type": "string",
          "description": "The ID used to identify the metrics configuration. The ID has a 64 character limit and can only contain letters, numbers, periods, dashes, and underscores."
        },
        "Filter": {
          "$ref": "#/$defs/MetricsFilter"
        }
      },
      "required": [
        "Id"
      ]
    },
    "MetricsFilter": {
      "type": "object",
      "properties": {
        "Prefix": {
          "type": "string",
          "description": "The prefix used when evaluating a metrics filter."
        },
        "Tag": {
          "$ref": "#/$defs/Tag"
        },
        "AccessPointArn": {
          "type": "string",
          "description": "The access point ARN used when evaluating a metrics filter."
        },
        "And": {
          "$ref": "#/$defs/MetricsAndOperator"
        }
      },
      "description": "Exactly one member is set."
    },
    "Tag": {
      "type": "object",
      "properties": {
        "Key": {
          "type": "string",
          "description": "Name of the object key."
        },
        "Value": {
          "type": "string",
          "description": "Value of the tag."
        }
      },
      "required": [
        "Key",
        "Value"
      ]
    }
  }
}