page

package
v1.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PageResourceMarkdownDescription = `

# Page resource

Docs about the different page types can be found [here](https://docs.getport.io/customize-pages-dashboards-and-plugins/page/catalog-page).

~> **WARNING**  
The page resource is currently in beta and is subject to change in future versions.  
Use it by setting the Environment Variable ` + "`PORT_BETA_FEATURES_ENABLED=true`" + `.  
If this Environment Variable isn't specified, you won't be able to use the resource. 

## Example Usage

### Blueprint Entities Page

` + "```hcl" + `

resource "port_page" "microservice_blueprint_page" {
  identifier            = "microservice_blueprint_page"
  title                 = "Microservices"
  type                  = "blueprint-entities"
  icon                  = "Microservice"
  blueprint             = port_blueprint.base_blueprint.identifier
  widgets               = [
    jsonencode(
      {
        "id" : "microservice-table-entities",
        "type" : "table-entities-explorer",
        "dataset" : {
          "combinator" : "and",
          "rules" : [
            {
              "operator" : "=",
              "property" : "$blueprint",
              "value" : ` + "{{`\"{{blueprint}}\"`}}" + `
            }
          ]
        }
      }
    )
  ]
}

` + "```" + `

### Dashboard Page

` + "```hcl" + `

resource "port_page" "microservice_dashboard_page" {
  identifier            = "microservice_dashboard_page"
  title                 = "Microservices"
  icon                  = "GitHub"
  type                  = "dashboard"
  widgets               = [
    jsonencode(
      {
        "id" : "dashboardWidget",
        "layout" : [
          {
            "height" : 400,
            "columns" : [
              {
                "id" : "microserviceGuide",
                "size" : 12
              }
            ]
          }
        ],
        "type" : "dashboard-widget",
        "widgets" : [
          {
            "title" : "Microservices Guide",
            "icon" : "BlankPage",
            "markdown" : "# This is the new Microservice Dashboard",
            "type" : "markdown",
            "description" : "",
            "id" : "microserviceGuide"
          }
        ],
      }
    )
  ]
}

` + "```" + `


### Page with parent

Create a page inside a folder.

` + "```hcl" + `

resource "port_page" "microservice_dashboard_page" {
  identifier            = "microservice_dashboard_page"
  title                 = "Microservices"
  icon                  = "GitHub"
  type                  = "dashboard"
  parent                = "microservices-folder"
  widgets               = [
    jsonencode(
      {
        "id" : "dashboardWidget",
        "layout" : [
          {
            "height" : 400,
            "columns" : [
              {
                "id" : "microserviceGuide",
                "size" : 12
              }
            ]
          }
        ],
        "type" : "dashboard-widget",
        "widgets" : [
          {
            "title" : "Microservices Guide",
            "icon" : "BlankPage",
            "markdown" : "# This is the new Microservice Dashboard",
            "type" : "markdown",
            "description" : "",
            "id" : "microserviceGuide"
          }
        ],
      }
    )
  ]
}

` + "```" + `


### Page with after

Create a page after another page.

` + "```hcl" + `

resource "port_page" "microservice_dashboard_page" {
  identifier            = "microservice_dashboard_page"
  title                 = "Microservices"
  icon                  = "GitHub"
  type                  = "dashboard"
  after                 = "microservices_entities_page"
  widgets               = [
    jsonencode(
      {
        "id" : "dashboardWidget",
        "layout" : [
          {
            "height" : 400,
            "columns" : [
              {
                "id" : "microserviceGuide",
                "size" : 12
              }
            ]
          }
        ],
        "type" : "dashboard-widget",
        "widgets" : [
          {
            "title" : "Microservices Guide",
            "icon" : "BlankPage",
            "markdown" : "# This is the new Microservice Dashboard",
            "type" : "markdown",
            "description" : "",
            "id" : "microserviceGuide"
          }
        ],
      }
    )
  ]
}

` + "```" + `

### Home Page

` + "```hcl" + `

resource "port_page" "home_page" {
  identifier            = "$home"
  title                 = "Home"
  type                  = "home"
  widgets               = [
    jsonencode(
      {
        "type" : "dashboard-widget",
        "id" : "azkLJD6wLk6nJSvA",
        "layout" : [
          {
            "columns" : [
              {
                "id" : "markdown",
                "size" : 6
              },
              {
                "id" : "overview",
                "size" : 6
              },
            ],
            "height" : 648
          }
        ],
        "widgets" : [
          {
            "type" : "markdown",
            "markdown" : "## Welcome to your internal developer portal",
            "icon" : "port",
            "title" : "About developer Portal",
            "id" : "markdown"
          },
          {
            "type" : "iframe-widget",
            "id" : "overview",
            "title" : "Overview",
            "icon" : "Docs",
            "url" : "https://www.youtube.com/embed/ggXL2ZsPVQM?si=xj6XtV0faatoOhss",
            "urlType" : "public"
          }
        ]
      }
    )
  ]
}

` + "```" + `

The home page is a special page, which is created by default when you create a new organization.

- When deleting the home page resource using terraform, the home page will not be deleted from Port as it isn't deletable page, instead, the home page will be removed from the terraform state. 
- Due to only having one home page you'll have to import the state of the home page manually.

` + "```" + `
terraform import port_page.home_page "\$home"
` + "```" + `
 
`

Functions

func NewPageResource

func NewPageResource() resource.Resource

func PageSchema

func PageSchema() map[string]schema.Attribute

func PageToPortBody

func PageToPortBody(pm *PageModel) (*cli.Page, error)

Types

type PageModel

type PageModel struct {
	ID         types.String   `tfsdk:"id"`
	Identifier types.String   `tfsdk:"identifier"`
	Title      types.String   `tfsdk:"title"`
	Type       types.String   `tfsdk:"type"`
	Parent     types.String   `tfsdk:"parent"`
	After      types.String   `tfsdk:"after"`
	Icon       types.String   `tfsdk:"icon"`
	Locked     types.Bool     `tfsdk:"locked"`
	Blueprint  types.String   `tfsdk:"blueprint"`
	Widgets    []types.String `tfsdk:"widgets"`
	CreatedAt  types.String   `tfsdk:"created_at"`
	CreatedBy  types.String   `tfsdk:"created_by"`
	UpdatedAt  types.String   `tfsdk:"updated_at"`
	UpdatedBy  types.String   `tfsdk:"updated_by"`
}

type PageResource

type PageResource struct {
	// contains filtered or unexported fields
}

func (*PageResource) Configure

func (*PageResource) Create

func (*PageResource) Delete

func (*PageResource) ImportState

func (*PageResource) Metadata

func (*PageResource) Read

func (*PageResource) Schema

func (*PageResource) Update

func (*PageResource) ValidateConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL