{
  "description": "AtlasNetworkPeering is the Schema for the AtlasNetworkPeering API",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "AtlasNetworkPeeringSpec defines the target state of AtlasNetworkPeering.",
      "properties": {
        "awsConfiguration": {
          "description": "AWSConfiguration is the specific AWS settings for network peering.",
          "properties": {
            "accepterRegionName": {
              "description": "AccepterRegionName is the provider region name of user's vpc in AWS native region format.",
              "type": "string"
            },
            "awsAccountId": {
              "description": "AccountID of the user's vpc.",
              "type": "string"
            },
            "routeTableCidrBlock": {
              "description": "User VPC CIDR.",
              "type": "string"
            },
            "vpcId": {
              "description": "AWS VPC ID.",
              "type": "string"
            }
          },
          "required": [
            "accepterRegionName",
            "awsAccountId",
            "routeTableCidrBlock",
            "vpcId"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "azureConfiguration": {
          "description": "AzureConfiguration is the specific Azure settings for network peering.",
          "properties": {
            "azureDirectoryId": {
              "description": "AzureDirectoryID is the unique identifier for an Azure AD directory.",
              "type": "string"
            },
            "azureSubscriptionId": {
              "description": "AzureSubscriptionID is the unique identifier of the Azure subscription in which the VNet resides.",
              "type": "string"
            },
            "resourceGroupName": {
              "description": "ResourceGroupName is the name of your Azure resource group.",
              "type": "string"
            },
            "vNetName": {
              "description": "VNetName is name of your Azure VNet. Its applicable only for Azure.",
              "type": "string"
            }
          },
          "required": [
            "azureDirectoryId",
            "azureSubscriptionId",
            "resourceGroupName",
            "vNetName"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "connectionSecret": {
          "description": "Name of the secret containing Atlas API private and public keys.",
          "properties": {
            "name": {
              "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "containerRef": {
          "description": "ContainerDualReference refers to a Network Container either by Kubernetes name or Atlas ID.",
          "properties": {
            "id": {
              "description": "ID is the Atlas identifier of the Network Container Atlas resource this Peering Connection relies on.\nUse either name or ID, not both.",
              "type": "string"
            },
            "name": {
              "description": "Name of the container Kubernetes resource, must be present in the same namespace.\nUse either name or ID, not both.",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "externalProjectRef": {
          "description": "externalProjectRef holds the parent Atlas project ID.\nMutually exclusive with the \"projectRef\" field.",
          "properties": {
            "id": {
              "description": "ID is the Atlas project ID.",
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "gcpConfiguration": {
          "description": "GCPConfiguration is the specific Google Cloud settings for network peering.",
          "properties": {
            "gcpProjectId": {
              "description": "User GCP Project ID. Its applicable only for GCP.",
              "type": "string"
            },
            "networkName": {
              "description": "GCP Network Peer Name. Its applicable only for GCP.",
              "type": "string"
            }
          },
          "required": [
            "gcpProjectId",
            "networkName"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "id": {
          "description": "ID is the peering identifier for an already existent network peering to be managed by the operator.\nThis field is immutable.",
          "type": "string"
        },
        "projectRef": {
          "description": "projectRef is a reference to the parent AtlasProject resource.\nMutually exclusive with the \"externalProjectRef\" field.",
          "properties": {
            "name": {
              "description": "Name of the Kubernetes Resource",
              "type": "string"
            },
            "namespace": {
              "description": "Namespace of the Kubernetes Resource",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "provider": {
          "description": "Name of the cloud service provider for which you want to create the network peering service.",
          "enum": [
            "AWS",
            "GCP",
            "AZURE"
          ],
          "type": "string"
        }
      },
      "required": [
        "containerRef",
        "provider"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "must define only one project reference through externalProjectRef or projectRef",
          "rule": "(has(self.externalProjectRef) && !has(self.projectRef)) || (!has(self.externalProjectRef) && has(self.projectRef))"
        },
        {
          "message": "must define a local connection secret when referencing an external project",
          "rule": "(has(self.externalProjectRef) && has(self.connectionSecret)) || !has(self.externalProjectRef)"
        },
        {
          "message": "must either have a container Atlas id or Kubernetes name, but not both (or neither)",
          "rule": "(has(self.containerRef.name) && !has(self.containerRef.id)) || (!has(self.containerRef.name) && has(self.containerRef.id))"
        },
        {
          "message": "container ref name is immutable",
          "rule": "(self.containerRef.name == oldSelf.containerRef.name) || (!has(self.containerRef.name) && !has(oldSelf.containerRef.name))"
        },
        {
          "message": "container ref id is immutable",
          "rule": "(self.containerRef.id == oldSelf.containerRef.id) || (!has(self.containerRef.id) && !has(oldSelf.containerRef.id))"
        },
        {
          "message": "id is immutable",
          "rule": "(self.id == oldSelf.id) || (!has(self.id) && !has(oldSelf.id))"
        }
      ],
      "additionalProperties": false
    },
    "status": {
      "description": "AtlasNetworkPeeringStatus is a status for the AtlasNetworkPeering Custom resource.\nNot the one included in the AtlasProject",
      "properties": {
        "awsStatus": {
          "description": "AWSStatus contains AWS only related status information",
          "properties": {
            "connectionId": {
              "description": "ConnectionID is the AWS VPC peering connection ID",
              "type": "string"
            },
            "vpcId": {
              "description": "VpcID is AWS VPC id on the Atlas side",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "azureStatus": {
          "description": "AzureStatus contains Azure only related status information",
          "properties": {
            "azureSubscriptionIDpcId": {
              "description": "AzureSubscriptionID is Azure Subscription id on the Atlas side",
              "type": "string"
            },
            "vNetName": {
              "description": "VnetName is Azure network on the Atlas side",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "conditions": {
          "description": "Conditions is the list of statuses showing the current state of the Atlas Custom Resource",
          "items": {
            "description": "Condition describes the state of an Atlas Custom Resource at a certain point.",
            "properties": {
              "lastTransitionTime": {
                "description": "Last time the condition transitioned from one status to another.\nRepresented in ISO 8601 format.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "A message providing details about the transition.",
                "type": "string"
              },
              "reason": {
                "description": "The reason for the condition's last transition.",
                "type": "string"
              },
              "status": {
                "description": "Status of the condition; one of True, False, Unknown.",
                "type": "string"
              },
              "type": {
                "description": "Type of Atlas Custom Resource condition.",
                "type": "string"
              }
            },
            "required": [
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "gcpStatus": {
          "description": "GCPStatus contains GCP only related status information",
          "properties": {
            "gcpProjectID": {
              "description": "GCPProjectID is GCP project on the Atlas side",
              "type": "string"
            },
            "networkName": {
              "description": "NetworkName is GCP network on the Atlas side",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "id": {
          "description": "ID recrods the identified of the peer created by Atlas",
          "type": "string"
        },
        "observedGeneration": {
          "description": "ObservedGeneration indicates the generation of the resource specification of which the Atlas Operator is aware.\nThe Atlas Operator updates this field to the value of 'metadata.generation' as soon as it starts reconciliation of the resource.",
          "format": "int64",
          "type": "integer"
        },
        "status": {
          "description": "Status describes the last status seen for the network peering setup",
          "type": "string"
        }
      },
      "required": [
        "conditions"
      ],
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
