diff --git a/404.html b/404.html index 2c4c1b1..7562ae2 100644 --- a/404.html +++ b/404.html @@ -1,2 +1,2 @@ 404 Page not found - AsCode - Terraform Alternative Syntax

404 Page Not Found

404 Page Not Found

Overview

Categories

AsCode allows you to describe your infrastructure using an expressive language in Terraform without writing a single line of HCL.

Runtime Modules

AsCode comes with a variety of modules available like http, math, encoding/json, etc. All this modules are available runtime through the load -statement. This example shows the usage of this modules and some others.

Overview

Documentation

AsCode - Terraform Alternative Syntax

AsCode is a tool to define infrastructure as code using the Starlark language on top of Terraform. It allows to describe your infrastructure using an expressive language in Terraform without writing a single line of HCL, meanwhile, you have the complete ecosystem of providers

Why?

Terraform is a great tool, with support for almost everything you can imagine, making it the industry leader. Terraform is based on HCL, a JSON-alike declarative language, with minimal control flow functionality. IMHO, to unleash the power of the IaC, a powerful, expressive language should be used, where basic elements like loops or functions are first-class citizens.

What is Starlark?

Starlark is a dialect of Python intended to be used as a configuration language. A Starlark interpreter is typically embedded within a larger application, and this application may define additional domain-specific functions and data types beyond those provided by the core language. For example, Starlark is embedded within (and was originally developed for) the Bazel build tool, and Bazel’s build language is based on Starlark.

encoding/base64

Index

Overview

base64 defines base64 encoding & decoding functions, often used to represent binary as text.

Functions

def decode

decode(src,encoding="standard") string
 

parse base64 input, giving back the plain string representation

Arguments
nametypedescription
srcstringsource string of base64-encoded text
encodingstringoptional. string to set decoding dialect. allowed values are: standard,standard_raw,url,url_raw

def encode

encode(src,encoding="standard") string
-

return the base64 encoding of src

Arguments
nametypedescription
srcstringsource string to encode to base64
encodingstringoptional. string to set encoding dialect. allowed values are: standard,standard_raw,url,url_raw

return the base64 encoding of src

Arguments
nametypedescription
srcstringsource string to encode to base64
encodingstringoptional. string to set encoding dialect. allowed values are: standard,standard_raw,url,url_raw

write all rows from source to a csv-encoded string

Arguments
nametypedescription
source[][]stringarray of arrays of strings to write to csv
commastringcomma is the field delimiter, defaults to “,” (a comma).comma must be a valid character and must not be \r, \n,or the Unicode replacement character (0xFFFD).

docker

Index

Overview

The docker modules allow you to manipulate docker image names.

Functions

def image

image(image, constraint) Image
 

Returns a new Image based on a given image and constraint.

Arguments
nametypedescription
imagestringContainer image name. Eg.: ubuntu or quay.io/prometheus/prometheus.
constraintstringSemver contraint. Eg.: 1.2.*

Types

type Image

Represents a docker container image.

Properties
nametypedescription
namestringImage name. Eg.: docker.io/library/fedora
domainstringRegistry domain. Eg.: docker.io.
pathstringRepository path. Eg.: library/fedora
Methods

def Image.tags

Image.tags() list
 

List of all the tags for this container image.

def Image.version

Image.version() string
-

Return the highest tag matching the image constraint.

Arguments
nametypedescription
fullboolIf true returns the image name plus the tag. Eg.: docker.io/library/fedora:29

Return the highest tag matching the image constraint.

Arguments
nametypedescription
fullboolIf true returns the image name plus the tag. Eg.: docker.io/library/fedora:29

perform an HTTP POST request, returning a response

Arguments
nametypedescription
urlstringurl to request
headersdictoptional. dictionary of headers to add to request
bodystringoptional. raw string body to provide to the request
form_bodydictoptional. dict of values that will be encoded as form data
json_bodyanyoptional. json data to supply as a request. handy for working with JSON-API’s
authtupleoptional. (username,password) tuple for http basic authorization

def put

put(url,params={},headers={},body="",form_body={},json_body={},auth=()) response
 

perform an HTTP PUT request, returning a response

Arguments
nametypedescription
urlstringurl to request
headersdictoptional. dictionary of headers to add to request
bodystringoptional. raw string body to provide to the request
form_bodydictoptional. dict of values that will be encoded as form data
json_bodyanyoptional. json data to supply as a request. handy for working with JSON-API’s
authtupleoptional. (username,password) tuple for http basic authorization

Types

type response

the result of performing a http request

Properties
nametypedescription
urlstringthe url that was ultimately requested (may change after redirects)
status_codeintresponse status code (for example: 200 == OK)
headersdictdictionary of response headers
encodingstringtransfer encoding. example: “octet-stream” or “application/json”
Methods

def response.body

response.body() string
 

output response body as a string

def response.json

response.json()
-

attempt to parse resonse body as json, returning a JSON-decoded result

attempt to parse resonse body as json, returning a JSON-decoded result

Overview

API Reference

built-in

builtin package represents the predefined, Terraform domain-specific,functions and types in the scope of any thread of AsCode. This meansthat is not required to use the load statement, and any of the functioncan be called without any prefix.

docker

The docker modules allow you to manipulate docker image names.

encoding/base64

base64 defines base64 encoding & decoding functions,often used to represent binary as text.

encoding/csv

csv reads comma-separated values files

encoding/json

json provides functions for working with json data

encoding/yaml

yaml provides functions for working with yaml data

http

http defines an HTTP client implementation

math

math defines mathematical functions, it’s intended to be a drop-insubset of python’s math module for starlark: https://docs.python.org/3/library/math.html

os

os provides a platform-independent interface to operating system functionality.

path/filepath

filepath implements utility routines for manipulating filename paths in away compatible with the target operating system-defined file path

re

re defines regular expression functions, it’s intended to be a drop-insubset of python’s re module for starlark: https://docs.python.org/3/library/re.html

time

time defines time primitives for starlark

read a source JSON string to a starlark object

Arguments
nametypedescription
sourcestringinput string of json data

Return the hyperbolic sine of x.

def sqrt

sqrt(x)
 

Return the square root of x.

def tan

tan(x)
 

Return the tangent of x radians.

def tanh

tanh(x)
-

Return the hyperbolic tangent of x.

Return the hyperbolic tangent of x.

retrieves the value of the environment variable named by the key.

Arguments
nametypedescription
filenamestringname of the file to be written
datastringcontent to be witten to the file
permsintoptional, permission of the file

Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. If the pattern isn’t found, string is returned unchanged. repl can be a string or a function; if it is a string, any backslash escapes in it are processed. -That is, \n is converted to a single newline character, \r is converted to a carriage return, and so forth.

Arguments
nametypedescription
patternstringregular expression pattern string
replstringstring to replace matches with
textstringinput string to replace
countintnumber of replacements to make, default 0 means replace all matches
flagsintinteger flags to control regex behaviour. reserved for future use

def time.minute

time.minute() int
 

def time.second

time.second() int
 

def time.nanosecond

time.nanosecond() int
-

read a source yaml string to a starlark object

Arguments
nametypedescription
sourcestringinput string of yaml data

A load statement within a function is a static error.

AsCode - Terraform Alternative Syntax

AsCode allows you to describe your infrastructure using an expressive language in Terraform without writing a single line of HCL.

Read The Docs
Overview

Tags