github.com/gophercloud/gophercloud@v1.11.0/openstack/containerinfra/v1/clustertemplates/doc.go (about)

     1  // Package clustertemplates contains functionality for working with Magnum Cluster Templates
     2  // resources.
     3  /*
     4  Package clustertemplates provides information and interaction with the cluster-templates through
     5  the OpenStack Container Infra service.
     6  
     7  Example to Create Cluster Template
     8  
     9  	boolFalse := false
    10  	boolTrue := true
    11  	createOpts := clustertemplates.CreateOpts{
    12  		Name:                "test-cluster-template",
    13  		Labels:              map[string]string{},
    14  		FixedSubnet:         "",
    15  		MasterFlavorID:      "",
    16  		NoProxy:             "10.0.0.0/8,172.0.0.0/8,192.0.0.0/8,localhost",
    17  		HTTPSProxy:          "http://10.164.177.169:8080",
    18  		TLSDisabled:         &boolFalse,
    19  		KeyPairID:           "kp",
    20  		Public:              &boolFalse,
    21  		HTTPProxy:           "http://10.164.177.169:8080",
    22  		ServerType:          "vm",
    23  		ExternalNetworkID:   "public",
    24  		ImageID:             "fedora-atomic-latest",
    25  		VolumeDriver:        "cinder",
    26  		RegistryEnabled:     &boolFalse,
    27  		DockerStorageDriver: "devicemapper",
    28  		NetworkDriver:       "flannel",
    29  		FixedNetwork:        "",
    30  		COE:                 "kubernetes",
    31  		FlavorID:            "m1.small",
    32  		MasterLBEnabled:     &boolTrue,
    33  		DNSNameServer:       "8.8.8.8",
    34  	}
    35  
    36  	clustertemplate, err := clustertemplates.Create(serviceClient, createOpts).Extract()
    37  	if err != nil {
    38  		panic(err)
    39  	}
    40  
    41  Example to Delete Cluster Template
    42  
    43  	clusterTemplateID := "dc6d336e3fc4c0a951b5698cd1236ee"
    44  	err := clustertemplates.Delete(serviceClient, clusterTemplateID).ExtractErr()
    45  	if err != nil {
    46  		panic(err)
    47  	}
    48  
    49  Example to List Clusters Templates
    50  
    51  	listOpts := clustertemplates.ListOpts{
    52  		Limit: 20,
    53  	}
    54  
    55  	allPages, err := clustertemplates.List(serviceClient, listOpts).AllPages()
    56  	if err != nil {
    57  		panic(err)
    58  	}
    59  
    60  	allClusterTemplates, err := clusters.ExtractClusterTemplates(allPages)
    61  	if err != nil {
    62  		panic(err)
    63  	}
    64  
    65  	for _, clusterTemplate := range allClusterTemplates {
    66  		fmt.Printf("%+v\n", clusterTemplate)
    67  	}
    68  
    69  Example to Update Cluster Template
    70  
    71  	updateOpts := []clustertemplates.UpdateOptsBuilder{
    72  		clustertemplates.UpdateOpts{
    73  			Op:    clustertemplates.ReplaceOp,
    74  			Path:  "/master_lb_enabled",
    75  			Value: "True",
    76  		},
    77  		clustertemplates.UpdateOpts{
    78  			Op:    clustertemplates.ReplaceOp,
    79  			Path:  "/registry_enabled",
    80  			Value: "True",
    81  		},
    82  	}
    83  
    84  	clustertemplate, err := clustertemplates.Update(serviceClient, updateOpts).Extract()
    85  	if err != nil {
    86  		panic(err)
    87  	}
    88  
    89  */
    90  package clustertemplates