text:
Address
====
This is the primary Address Class used for all things Domnio's.

If you have cloned this repo, you can run the example with this command:
`node ./example/address.js`

extends `DominosFormat` class, see more in [DominosFormat.md](https://github.com/RIAEvangelist/node-dominos-pizza-api/blob/master/docs/DominosFormat.md)

Constructor
====

`new Address({...})`

|argument|type                              |required|description|
|--------|------                            |--------|-------|
|address |`AddressObject`/`AddressString`   |true    |the instance table below shows all the useable `AddressObject` fields |

Instance
====

Also check the [DominosFormat.md](https://github.com/RIAEvangelist/node-dominos-pizza-api/blob/master/docs/DominosFormat.md) as this class extends it.

|member/method|type  |description|
|-------------|------|-------    |
|.street      |String|street address (most commonly used to combine street number, name and apt number)|
|.streetName  |String|street name|
|.streetNumber|String|street number|
|.unitType    |String|unit type, suite, apt etc.|
|.unitNumber  |String|apartment number|
|.city        |String|address city|
|.region      |String|in the US this would be the state. In other countries it may be the province or prefecture|
|.postalCode  |String|address postal or zip code|
|.deliveryInstructions|String|This is for special injstructions, like ring the bell, or please don't give the Pizza to the old lady out front, she is not my Grandma, and always steals my food deliverys.|

#### AddressObject

Instead of passing an address string when initing the Address class (which needs to be parsed and can be comlicated), you can instead collect the address information and format it into an AddressObject. Dominos will try to figure the address out from any combination of address parts. None of these fields are required, but you should atleast provide enough information for Dominos to figure out the general location.

```js

  const addressObject={
      street:'900 Clark Ave Apt. 2B',
      city:'St. Louis',
      region:'MO',
      postalCode:'63102',
      deliveryInstructions:'please dont give the Pizza to the old lady out front, she is not my Grandma.'
  }

```

#### Full and Partial Address Instantiation

The Address class will do its best to parse an AddressString into an AddressObject, and/or massage the AddressObject into a dominos api formatted Address.

```js

  import {Address} from 'dominos';

  //full address examples
  const address = new Address(
      {
          street:'900 Clark Ave',
          city:'St. Louis',
          region:'MO',
          postalCode:'63102'
      }
  );

  const address=new Address('900 Clark Ave, St. Louis, MO, 63102');

  //partial address examples
  const address = new Address(
      {
          street:'900 Clark Ave',
          city:'St. Louis',
          postalCode:'63102'
      }
  );

  const address=new Address('900 Clark Ave, St. Louis, 63102');

  //street and zip only examples
  const fullAddressObject = new Address(
      {
          street:'900 Clark Ave',
          postalCode:'63102'
      }
  );

  const address=new Address('900 Clark Ave, 63102');

  //zip only examples
  const fullAddressObject = new Address(
      {
          postalCode:'63102'
      }
  );

  const onlyZip = new Address('63102');

```

#### `address.formatted` Dominos API Formatted Address

Dominos API uses pascal case for the Address object, we convert the values set to the other members of the address object to conform to the Dominos spec here.

```js

  import {Address} from 'dominos';

  const address=new Address('900 Clark Ave, St. Louis, MO, 63102');

  console.log(address.formatted);

```

This outputs the dominos style address object.

```js

    {
        Street:'900 Clark Ave',
        City:'St. Louis',
        Region:'MO',
        PostalCode:'63102'
    }

```

repository: RIAEvangelist/node-dominos-pizza-api

repo_name: RIAEvangelist/node-dominos-pizza-api


text:
---
layout: post
title: MongoExec (Sublime Package)
date: 2015-11-29 13:33
author: Juan Medina
comments: true
categories: [Programming]
image: /assets/img/mongoexec.gif
image-sm: /assets/img/mongoexec.gif
---
I found the other day a wonderful package for [Sublime Text](http://www.sublimetext.com/3){:target="_blank"}, [MongoExec](https://packagecontrol.io/packages/MongoExec){:target="_blank"}.

Allows to execute MongoDB queries within sublime text and other stuff like browse database a collection.

In understand that there is available a lot of tools to browse a Mongo database but the got things of having this as a sublime package is that allow to do everything within sublime, so more productivity.

I like to copy fields and data within the same editor.

So far love it.

license: MIT

repository: juan-medina/blog

branch_name: refs/heads/master

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive

repo_name: juan-medina/blog


text:
---
title : KS
layout : datapage
permalink : /states/KS/
---

[Project Homepage]({{ site.baseurl}}/)

[KS-01](#KS-01)  [KS-02](#KS-02)  [KS-03](#KS-03)  [KS-04](#KS-04)

# KS -- Sen. Pat Roberts (R) and  Sen. Jerry Moran (R)
## Committees
Jerry Moran is the #1 Republican on the Senate Appropriations Subcommittee on Commerce, Justice, Science, and Related Agencies

Jerry Moran is the #8 Republican on the Senate Committee on Appropriations

Jerry Moran is the #6 Republican on the Senate Committee on Commerce, Science, and Transportation

## HEP Grants
In the past 9 years, this state has received:
30 HEP grants, totalling  $7,386,500
```
  Year  Institution                Amount ($)
------  -----------------------  ------------
  2019  Kansas State University       930,000
  2019  University of Kansas                0
  2018  Kansas State University       958,000
  2018  University of Kansas                0
  2017  Kansas State University       950,000
  2017  University of Kansas          262,000
  2016  Kansas State University       765,000
  2016  University of Kansas                0
  2015  Kansas State University       750,000
  2015  University of Kansas          140,000
  2014  Kansas State University       631,000
  2014  University of Kansas           47,500
  2013  Kansas State University       920,000
  2013  University of Kansas           48,000
  2012  Kansas State University       775,000
  2012  University of Kansas          210,000
```
## SC Contracts
In the past 9 years, this state has received:
3 Office of Science contracts, totalling  $66,015
```
  Year  Vendor                    Amount ($)  Item
------  ----------------------  ------------  ------------
  2015  Fishnet Security, Inc.        22,005  ADP Software
  2014  Fishnet Security, Inc.        22,005  ADP Software
  2013  Fishnet Security, Inc.        22,005  ADP Software
```
## NSF MPS Grants
In the past 9 years, this state has received:
208 NSF MPS grants, totalling  $41,927,306
```
Institution                                 Amount ($)
----------------------------------------  ------------
University Of Kansas Center For Research    25,050,146
Kansas State University                     13,914,884
Wichita State University                     2,442,127
University Of Kansas Ctr For Res In            370,149
Emporia State University                       150,000
```
## SULI/CCI Interns

![KS SULI/CCI image]({{ site.baseurl }}/img/KS.png)

From 2014-2018, this state had 19 SULI/CCI interns
```
  # Interns  Program    College
-----------  ---------  --------------------------------
          8  SULI       University of Kansas Main Campus
          5  SULI       Kansas State University
          3  SULI       Benedictine College
          1  SULI       Johnson County Community College
          1  SULI       Wichita State University
```
19
---
---

[Back to top](#top)
## KS-01 -- Rep. Roger W. Marshall (R) -- [Wikipedia](https://en.wikipedia.org/wiki/KS-01)
## Committees
Roger W. Marshall is the #7 Republican on the House Committee on Science, Space, and Technology

## HEP Grants
In the past 9 years, this district has received: $4,984,000 in SC HEP grants.
```
Institution                Amount ($)    Start    End  Principal Investigator    Project Title
-----------------------  ------------  -------  -----  ------------------------  --------------------------------------------------------------------------------------------
Kansas State University        83,000     2018   2020  Ratra, Bharat             Testing Non-Flat, Dynamical Dark Energy, Inflation Models
Kansas State University     4,301,000     2014   2020  Horton-Smith, Glenn       Research at Kansas State University into the Basic Nature of Matter, Energy, Space, and Time
Kansas State University       600,000     2014   2018  Ivanov, Andrew            Quest for a Top Quark Partner and Upgrade of the Pixel Detector Readout Chain at the CMS
```
## SC Contracts
```
This district received no SC contracts from 2012-2020
```
## NSF MPS Grants
In the past 9 years, this district has received: $11,250,803 in NSF MPS grants.
```
  Year  Institution                Amount ($)
------  -----------------------  ------------
  2019  Kansas State University     1,618,732
  2018  Kansas State University     2,444,904
  2017  Kansas State University     3,043,002
  2016  Kansas State University        17,924
  2015  Kansas State University     2,375,266
  2014  Kansas State University       614,255
  2013  Kansas State University     1,136,720
```
## SULI/CCI Interns
From 2014-2018, this district had 5 SULI/CCI interns
```
Term         Name                     College                  Host Lab                                Program
-----------  -----------------------  -----------------------  --------------------------------------  ---------
Summer 2017  Dalton Hahn              Kansas State University  Argonne National Laboratory             SULI
Summer 2017  Jennifer Ann Spero       Kansas State University  Lawrence Livermore National Laboratory  SULI
Summer 2016  Dalton Hahn              Kansas State University  Pacific Northwest National Laboratory   SULI
Summer 2015  Morgan Shmidl            Kansas State University  Ames National Laboratory                SULI
Summer 2014  William Thomas Hamilton  Kansas State University  National Renewable Energy Laboratory    SULI
```
---

[Back to top](#top)
## KS-02 -- Rep. Steven C. Watkins, Jr. (R) -- [Wikipedia](https://en.wikipedia.org/wiki/KS-02)
## Committees
Steven C. Watkins, Jr. is the #10 Republican on the House Subcommittee on Higher Education and Workforce Development

## HEP Grants
In the past 9 years, this district has received: $2,402,500 in SC HEP grants.
```
Institution                Amount ($)    Start  End      Principal Investigator    Project Title
-----------------------  ------------  -------  -------  ------------------------  ----------------------------------------------------------------------------------------
University of Kansas          136,000     2017  Ongoing  Kong, Kyoungchul          Searches for New Phenomena Beyond the Standard Model
University of Kansas          126,000     2017  2020     Lewis, Ian                Searches for New Physics in Standard Model Processes
University of Kansas          187,500     2014  2018     Kong, Kyoungchul          Search for New Phenomena Beyond the Standard Model
Kansas State University       920,000     2013  2014     Horton-Smith              Heavy Quark and Neutrino Physics
Kansas State University             0     2013  2014     Ivanov                    Quest for a Top Quark Partner and Upgrade of the Pixel Detector Readout Chain at the CMS
University of Kansas                0     2013  2014     Marfatia                  Research In Theoretical Particle Physics
Kansas State University       720,000     2012  2013     Bolton                    Heavy Quark and Neutrino Physics
Kansas State University        55,000     2012  2013     Ivanov                    Exploiting Third Generation Quarks for New Physics Discoveries at the Energy Frontier
University of Kansas           98,000     2012  2014     Kong                      Hunt for New Physics at the Large Hadron Collider
University of Kansas          160,000     2012  2013     Ralston                   Research in Theoretical Particle Physics
```
## SC Contracts
```
This district received no SC contracts from 2012-2020
```
## NSF MPS Grants
In the past 9 years, this district has received: $24,318,188 in NSF MPS grants.
```
  Year  Institution                                 Amount ($)
------  ----------------------------------------  ------------
  2019  University Of Kansas Center For Research     2,329,009
  2018  University Of Kansas Center For Research     3,266,415
  2017  University Of Kansas Center For Research     4,099,408
  2016  University Of Kansas Center For Research     3,211,374
  2015  University Of Kansas Center For Research     2,364,365
  2015  University Of Kansas Ctr For Res In            370,149
  2014  University Of Kansas Center For Research     2,785,414
  2013  University Of Kansas Center For Research     3,227,973
  2012  Kansas State University                      2,664,081
```
## SULI/CCI Interns
From 2014-2018, this district had 3 SULI/CCI interns
```
Term         Name                   College              Host Lab                                        Program
-----------  ---------------------  -------------------  ----------------------------------------------  ---------
Summer 2017  Joseph Barnes          Benedictine College  Idaho National Laboratory                       SULI
Summer 2016  Laura Elizabeth Tibbs  Benedictine College  Ames National Laboratory                        SULI
Summer 2016  Andrew Jacobs          Benedictine College  Thomas Jefferson National Accelerator Facility  SULI
```
---

[Back to top](#top)
## KS-03 -- Rep. Sharice Davids (D) -- [Wikipedia](https://en.wikipedia.org/wiki/KS-03)
## HEP Grants
```
This district received no SC HEP grants from 2012-2020
```
## SC Contracts
In the past 9 years, this district has received:
3 Office of Science contracts, totalling  $66,015
```
  Year  Vendor                    Amount ($)  Item
------  ----------------------  ------------  ------------
  2015  Fishnet Security, Inc.        22,005  ADP Software
  2014  Fishnet Security, Inc.        22,005  ADP Software
  2013  Fishnet Security, Inc.        22,005  ADP Software
```
## NSF MPS Grants
In the past 9 years, this district has received: $3,766,188 in NSF MPS grants.
```
  Year  Institution                                 Amount ($)
------  ----------------------------------------  ------------
  2013  University Of Kansas Center For Research        87,000
  2012  University Of Kansas Center For Research     3,679,188
```
## SULI/CCI Interns
From 2014-2018, this district had 9 SULI/CCI interns
```
Term         Name                     College                           Host Lab                               Program
-----------  -----------------------  --------------------------------  -------------------------------------  ---------
Summer 2018  Olurotimi Paul Ajayi     University of Kansas Main Campus  Argonne National Laboratory            SULI
Summer 2018  Maridee Ann Weber        Johnson County Community College  Argonne National Laboratory            SULI
Summer 2018  David Trevino Jr         University of Kansas Main Campus  Ames National Laboratory               SULI
Summer 2016  Andrew Ying              University of Kansas Main Campus  Lawrence Berkeley National Laboratory  SULI
Summer 2015  William Thomas Hamilton  University of Kansas Main Campus  National Renewable Energy Laboratory   SULI
Summer 2014  Jason Schutte Bates      University of Kansas Main Campus  National Renewable Energy Laboratory   SULI
Summer 2014  Daniel Kennedy           University of Kansas Main Campus  Princeton Plasma Physics Laboratory    SULI
Spring 2015  Gregory Pach             University of Kansas Main Campus  National Renewable Energy Laboratory   SULI
Fall 2014    Gregory Pach             University of Kansas Main Campus  National Renewable Energy Laboratory   SULI
```
---

[Back to top](#top)
## KS-04 -- Rep. Ron Estes (R) -- [Wikipedia](https://en.wikipedia.org/wiki/KS-04)
## HEP Grants
```
This district received no SC HEP grants from 2012-2020
```
## SC Contracts
```
This district received no SC contracts from 2012-2020
```
## NSF MPS Grants
In the past 9 years, this district has received: $2,592,127 in NSF MPS grants.
```
  Year  Institution                 Amount ($)
------  ------------------------  ------------
  2019  Wichita State University       268,098
  2018  Wichita State University        16,500
  2017  Wichita State University       728,000
  2016  Emporia State University       150,000
  2016  Wichita State University       508,018
  2015  Wichita State University       305,500
  2012  Wichita State University       616,011
```
## SULI/CCI Interns
From 2014-2018, this district had 2 SULI/CCI interns
```
Term         Name               College                   Host Lab                               Program
-----------  -----------------  ------------------------  -------------------------------------  ---------
Summer 2017  Reed Scott Bowles  Wichita State University  Fermi National Accelerator Laboratory  SULI
Summer 2017  Reed Bowles        Wichita State University  Fermi National Accelerator Laboratory  nan
```
---

branch_name: refs/heads/main

gha_language: Python


text:
### Problem 1. Make person
*	Write a function for creating persons.
	*	Each person must have **firstname**, **lastname**, **age** and **gender** (true is female, false is male)
* 	Generate an array with ten person with different names, ages and genders

url: https://raw.githubusercontent.com/dushka-dragoeva/TelerikSeson2016/ecddeea2e02755f2096d580de653aa10ceb72bcd/Web Design and UI/JS Fundamentals/10. Methods on Arrays and Objects/homework/01. Make person/README.md


text:
---
title: Sending Backup Notification to Slack | Stash
menu:
  docs_{{ .version }}:
    identifier: hoooks-slack-notification
    name: Slack Notification
    parent: hooks
    weight: 25
product_name: stash
menu_name: docs_{{ .version }}
section_menu_id: guides
---

# Sending Backup Notification to Slack Channel

In this guide, we are going to show you how to send backup notifications to a Slack channel. Here, we are going to use [Slack Incoming Webook](https://api.slack.com/messaging/webhooks) to send the notification.

## Before You Begin

- At first, you need to have a Kubernetes cluster, and the `kubectl` command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/).
- Install Stash Enterprise in your cluster following the steps [here](/docs/setup/install/enterprise/index.md).
- If you haven't read about how hooks work in Stash, please check it from [here](/docs/guides/hooks/overview/index.md).

You should be familiar with the following `Stash` concepts:

- [BackupBatch](/docs/concepts/crds/backupbatch/index.md)
- [BackupSession](/docs/concepts/crds/backupsession/index.md)
- [Repository](/docs/concepts/crds/repository/index.md)
- [Function](/docs/concepts/crds/function/index.md)
- [Task](/docs/concepts/crds/task/index.md)

To keep everything isolated, we are going to use a separate namespace called `demo` throughout this tutorial.

```bash
$ kubectl create ns demo
namespace/demo created
```

## Configure Slack Incoming Webhook

At first, let's configure a Slack incoming webhook. We are going to send the notifications to a channel named `notification-test`. Now, follow the steps below:

- Go to https://api.slack.com/ and click the `Create an app` button as highlighted in the red rectangle in the following image.

- We are going to build a new app.  Then, click on the  `Allow` button.

- Finally, copy the webhook path starting from `/service/****`. We will use this path in our hook specification.

Our Slack incoming webhook is ready to receive notifications. In the next section, we are going to configure a Stash webhook to send backup notifications to this incoming webhook.

## Prepare Application

Now, let's deploy a sample application and generate some sample data for it. Here, is the YAML of a Deployment along with its PVC that we are going to deploy:

```yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: stash-sample-data
  namespace: demo
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: stash-demo
  name: stash-demo
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: stash-demo
  template:
    metadata:
      labels:
        app: stash-demo
      name: busybox
    spec:
      containers:
      - args: ["sleep 3000"]
        command: ["/bin/sh", "-c"]
        image: busybox
        imagePullPolicy: IfNotPresent
        name: busybox
        volumeMounts:
        - mountPath: /source/data
          name: source-data
      restartPolicy: Always
      volumes:
      - name: source-data
        persistentVolumeClaim:
          claimName: stash-sample-data
```

Let's deploy the above deployment.

```bash
❯ kubectl apply -f https://github.com/stashed/docs/raw/{{< param "info.version" >}}/docs/guides/hooks/slack-notification/examples/deployment.yaml
persistentvolumeclaim/stash-sample-data created
deployment.apps/stash-demo created
```

Once the deployment is running, lets exec into its pod and create some sample file in `/source/data` directory.

```bash
❯ kubectl exec -n demo stash-demo-669d77dfc4-nhdgg -- touch /source/data/file-1.txt
❯ kubectl exec -n demo stash-demo-669d77dfc4-nhdgg -- touch /source/data/file-2.txt
❯ kubectl exec -n demo stash-demo-669d77dfc4-nhdgg -- touch /source/data/file-3.txt
```

Let's verify that the files have been created successfully:

```bash
❯ kubectl exec -n demo stash-demo-669d77dfc4-nhdgg -- ls /source/data
file-1.txt
file-2.txt
file-3.txt
```

Our application is ready with some sample data. In the next section, we are going to setup a backup for this application.

## Prepare Backend

We are going to store our backed-up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` CR. If you want to use a different backend, please read the respective backend configuration doc from [here](/docs/guides/backends/overview/index.md).

**Create Storage Secret:**

Let's create a secret called `gcs-secret` with access credentials to our desired GCS bucket,

```bash
$ echo -n 'changeit' > RESTIC_PASSWORD
$ echo -n '<your-project-id>' > GOOGLE_PROJECT_ID
$ cat /path/to/downloaded-sa-key.json > GOOGLE_SERVICE_ACCOUNT_JSON_KEY
$ kubectl create secret generic -n demo gcs-secret \
    --from-file=./RESTIC_PASSWORD \
    --from-file=./GOOGLE_PROJECT_ID \
    --from-file=./GOOGLE_SERVICE_ACCOUNT_JSON_KEY
secret/gcs-secret created
```

**Create Repository:**

Now, create a `Repository` using this secret. Below is the YAML of Repository CR we are going to create,

```yaml
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
  name: gcs-repo
  namespace: demo
spec:
  backend:
    gcs:
      bucket: stash-testing
      prefix: /webinar/slack-notification
    storageSecretName: gcs-secret
```

Let's create the `Repository` we have shown above,

```bash
$ kubectl apply -f https://github.com/stashed/docs/raw/{{< param "info.version" >}}/docs/guides/hooks/slack-notification/examples/repository.yaml
repository.stash.appscode.com/gcs-repo created
```

Now, we are ready to backup our application into our desired backend.

## Backup

In this section, we are going to setup a backup for the application we deployed earlier. We are going to configure a `postBackup` hook to send a notification to our Slack incoming webhook when a backup session completes.

Here, is the YAML of the BackupConfiguration that we are going to create:

```yaml
apiVersion: stash.appscode.com/v1beta1
kind: BackupConfiguration
metadata:
  name: deployment-backup
  namespace: demo
spec:
  repository:
    name: gcs-repo
  schedule: "*/5 * * * *"
  target:
    ref:
      apiVersion: apps/v1
      kind: Deployment
      name: stash-demo
    volumeMounts:
    - name: source-data
      mountPath: /source/data
    paths:
    - /source/data
  hooks:
    postBackup:
      executionPolicy: Always
      httpPost:
        host: hooks.slack.com
        path: /services/XX/XXX/XXXX
        port: 443
        scheme: HTTPS
        httpHeaders:
          - name: Content-Type
            value: application/json
        body: |
          {{- $msg := dict  "type" "mrkdwn" "text" (printf "Backup completed for %s/%s Status: %s." .Namespace .Target.Name .Status.Phase) -}}
          {
            "blocks": [
                {
                  "type": "section",
                  "text": {{ toJson $msg }}
                }
              ]
          }
  retentionPolicy:
    name: 'keep-last-5'
    keepLast: 5
    prune: true
```

Notice the `hooks` section. We have setup a `postBackup` hook which sends an HTTP POST request. In the `path` field of the `httpPost` section, we have specified the Slack incoming webhook path that we copied in the last step of configuring Slack incoming webhook.

Also, notice the `body` field of the `httpPost` section. We have used Go template to include information about the backup target and status.

Let's create the BackupConfiguration we have shown above,

```bash
❯ kubectl apply -f https://github.com/stashed/docs/raw/{{< param "info.version" >}}/docs/guides/hooks/slack-notification/examples/all_backup_notification.yaml
backupconfiguration.stash.appscode.com/deployment-backup created
```

**Wait for BackupSession:**

Now, let's wait for a BackupSession. Run the following command to watch for BackupSession.

```bash
❯ kubectl get backupsession --all-namespaces -w
NAMESPACE   NAME                           INVOKER-TYPE          INVOKER-NAME        PHASE   DURATION   AGE
demo        deployment-backup-1650277200   BackupConfiguration   deployment-backup                      0s
demo        deployment-backup-1650277200   BackupConfiguration   deployment-backup   Pending              0s
demo        deployment-backup-1650277200   BackupConfiguration   deployment-backup   Running              0s
demo        deployment-backup-1650277200   BackupConfiguration   deployment-backup   Succeeded   31s      30s
```

We can see from the above output that the backup session has succeeded.

**Verify Notification:**

Now, if we go to the Slack channel we have configured for notification. We should see a notification similar to this:

### Sending Only Backup Failure Notification

We can also use the `executionPolicy` to send notification only for the failed backups. Check the following BackupConfiguration:

```yaml
apiVersion: stash.appscode.com/v1beta1
kind: BackupConfiguration
metadata:
  name: deployment-backup
  namespace: demo
spec:
  repository:
    name: gcs-repo
  schedule: "*/5 * * * *"
  target:
    ref:
      apiVersion: apps/v1
      kind: Deployment
      name: stash-demo
    volumeMounts:
    - name: source-data
      mountPath: /source/data
    paths:
    - /path/does/not/exist
  hooks:
    postBackup:
      executionPolicy: OnFailure
      httpPost:
        host: hooks.slack.com
        path: /services/XX/XXX/XXXX
        port: 443
        scheme: HTTPS
        httpHeaders:
          - name: Content-Type
            value: application/json
        body: |
          {{- $msg := dict  "type" "mrkdwn" "text" (printf ":x: Backup failed for %s/%s Reason: %s." .Namespace .Target.Name .Status.Error) -}}
          {
            "blocks": [
                {
                  "type": "section",
                  "text": {{ toJson $msg }}
                }
              ]
          }
  retentionPolicy:
    name: 'keep-last-5'
    keepLast: 5
    prune: true
```

Here, we have provided an invalid path in the `paths` field of the `target` section. This will force the backup to fail.

Notice that, this time we have specified the `executionPolicy` field to `OnFailure`. This will tell Stash to send the notification only if the backup fail. In the message body, we have included information about target and reason of failure.

Let's apply the above BackupConfiguration:

```bash
❯ kubectl apply -f https://github.com/stashed/docs/raw/{{< param "info.version" >}}/docs/guides/hooks/slack-notification/examples/failed_backup_notification.yaml
backupconfiguration.stash.appscode.com/deployment-backup configured
```

**Wait for BackupSession:**

Again, let's wait for a scheduled backup. Run the following command to watch for a BackupSession:

```bash
❯ kubectl get backupsession --all-namespaces -w
NAMESPACE   NAME                           INVOKER-TYPE          INVOKER-NAME        PHASE   DURATION   AGE
demo        deployment-backup-1650277554   BackupConfiguration   deployment-backup                      0s
demo        deployment-backup-1650277554   BackupConfiguration   deployment-backup   Pending              0s
demo        deployment-backup-1650277554   BackupConfiguration   deployment-backup   Running              5s
demo        deployment-backup-1650277554   BackupConfiguration   deployment-backup   Failed    6s         5s
```

As we can see that the backup has failed this time. Let's verify the failure notification.

**Verify Notification:**

If we go to the Slack channel, we should see a new notification has been sent.

repository: stashed/docs

gha_language: Shell

repo_name: stashed/docs


text:
# lasthenia_docker

Container for reproducing results in, "Grow where you thrive, or where only you can survive? An analysis of performance curve evolution in a clade with diverse habitat affinities."

 Skip to the steps starting with `touch` to reproduce the analyses.

Running the above with sudo may be required depending on your Docker settings.

Looking at the first option above, the 80:8787 specifies the ports to use on your machine and in the container respectively. 8787 is the default for RStudio server, which could be in use by another user, which is why I've haphazardly chosen 80. Don't forget to change `<PASSWORD>` to an actual password.

If you chose the first command, next open your web browser and type:

    localhost:80

or:

    <server_ip_address>:80

You should be prompted to type a username and password. Use rstudio as your username and use the password you chose above. Once inside RStudio server, switch from the Console tab to the Terminal in the lower left panel.

To reproduce all major analyses reported in the paper, run the following in the Terminal (preferably in RStudio server to facilitate opening PDFs of figures in the browser):

    cd lasthenia_curves/
    sudo su

    #change timestamps to trigger make to start at first rule
    touch */*
    make

Some warnings and errors may occur (mostly about x11, others about perl scripts), but all analyses will be produced.

It will take several hours for the pipeline to finish.

For those familiar with the paper, there is a set of simulations intended to explore our assumption of equal spacing among treatments. This takes several days to run, so was intentionally excluded in the Makefile. If these results are of interest, the best way to do so is opening the `simulate_axis.R` script in Rstudio and running the commands within.

If you would like to interact with the generated files on your host computer, you can get them out of the container using the following:

    #determine container id (last column)
    docker ps

    #copy lasthenia curves to working directory on host machine
    docker cp <containerId>:/home/rstudio/lasthenia_curves .

Once you're happy, you can stop the container using:

    docker stop <containerId>

If issues occur, or you have any questions at all, I would love to hear about them --please email me! silas(dot)tittes(at)gmail(dot)com


text:
# Step CLI Integration Tests

## How To Run

Run all the integration tests:
```
make integration
```

Run only integration tests that match a regex:
```
go test -tags=integration ./integration/... -run <REGEX>
```

repository: smallstep/cli

gha_language: Go

repo_name: smallstep/cli