Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tombuildsstuff/golang-iis
A library enabling IIS to be managed via Golang
https://github.com/tombuildsstuff/golang-iis
automation golang iis windows
Last synced: 10 days ago
JSON representation
A library enabling IIS to be managed via Golang
- Host: GitHub
- URL: https://github.com/tombuildsstuff/golang-iis
- Owner: tombuildsstuff
- License: mit
- Created: 2018-11-06T21:19:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-14T07:13:35.000Z (about 2 years ago)
- Last Synced: 2024-11-02T09:32:07.406Z (17 days ago)
- Topics: automation, golang, iis, windows
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 9
- Watchers: 5
- Forks: 11
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# golang-iis
Enables management of Windows IIS from Golang.
### Why?
Good question. IIS is a bit of a unmanageable beast - this library tries to make it friendlier, for if you were doing something crazy like automating it.
## Requirements
- Go 1.10+ (possibly earlier, but untested)
- Access to a machine with IIS### Example Usage
```go
import (
"log""github.com/tombuildsstuff/golang-iis/iis"
)func main() {
log.Printf("Example app launched..")websiteName := "my-website"
appPoolName := "my-app-pool"
physicalPath := "C:\\inetpub\\wwwroot"err := run(websiteName, appPoolName, physicalPath)
if err != nil {
// handle the error better than this
panic(err)
}
}func run(websiteName string, appPoolName string, physicalPath string) error {
client, err := iis.NewClient()
if err != nil {
return err
}log.Printf("Creating App Pool %q..", appPoolName)
err = client.AppPools.Create(appPoolName)
if err != nil {
return fmt.Errorf("Error creating App Pool %q: %+v", appPoolName, err)
}log.Printf("Creating Website %q exists..", websiteName)
err = client.Websites.Create(websiteName, appPoolName, physicalPath)
if err != nil {
return fmt.Errorf("Error creating Website %q: %+v", websiteName, err)
}return nil
}
```More examples can be found in [the `./examples` directory](https://github.com/tombuildsstuff/golang-iis/tree/master/examples) in the root of this repository.
## Running the Tests
If you're running Windows and have IIS installed, you should be able to run `go test -v ./... -parallel=1` and things should run. This is significantly quicker than provisioning the Virtual Machine since the files don't need to be replicated.
If you're not running Windows - there's a [HashiCorp Terraform](https://terraform.io) script available which will provision a Windows VM (currently only in Azure, but other providers would be cool) which runs the tests remotely [which can be found here](https://github.com/tombuildsstuff/golang-iis/tree/master/terraform).
## Licence
MIT