jkawamoto/roadie

View on GitHub
cloud/azure/batch/client/certificates/certificates_client.go

Summary

Maintainability
A
0 mins
Test Coverage
package certificates

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
    "github.com/go-openapi/runtime"

    strfmt "github.com/go-openapi/strfmt"
)

// New creates a new certificates API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
    return &Client{transport: transport, formats: formats}
}

/*
Client for certificates API
*/
type Client struct {
    transport runtime.ClientTransport
    formats   strfmt.Registry
}

/*
CertificateAdd adds a certificate to the specified account
*/
func (a *Client) CertificateAdd(params *CertificateAddParams) (*CertificateAddCreated, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewCertificateAddParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "Certificate_Add",
        Method:             "POST",
        PathPattern:        "/certificates",
        ProducesMediaTypes: []string{"application/json"},
        ConsumesMediaTypes: []string{"application/json; odata=minimalmetadata"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &CertificateAddReader{formats: a.formats},
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    return result.(*CertificateAddCreated), nil

}

/*
CertificateCancelDeletion cancels a failed deletion of a certificate from the specified account

If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deletefailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate.
*/
func (a *Client) CertificateCancelDeletion(params *CertificateCancelDeletionParams) (*CertificateCancelDeletionNoContent, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewCertificateCancelDeletionParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "Certificate_CancelDeletion",
        Method:             "POST",
        PathPattern:        "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})/canceldelete",
        ProducesMediaTypes: []string{"application/json"},
        ConsumesMediaTypes: []string{"application/json; odata=minimalmetadata"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &CertificateCancelDeletionReader{formats: a.formats},
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    return result.(*CertificateCancelDeletionNoContent), nil

}

/*
CertificateDelete deletes a certificate from the specified account

You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that the certificate is not associated with any existing pools, the certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you try to delete a certificate that is in use, the deletion fails. The certificate status changes to deletefailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the certificate.
*/
func (a *Client) CertificateDelete(params *CertificateDeleteParams) (*CertificateDeleteAccepted, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewCertificateDeleteParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "Certificate_Delete",
        Method:             "DELETE",
        PathPattern:        "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})",
        ProducesMediaTypes: []string{"application/json"},
        ConsumesMediaTypes: []string{"application/json; odata=minimalmetadata"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &CertificateDeleteReader{formats: a.formats},
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    return result.(*CertificateDeleteAccepted), nil

}

/*
CertificateGet Gets information about the specified certificate.
*/
func (a *Client) CertificateGet(params *CertificateGetParams) (*CertificateGetOK, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewCertificateGetParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "Certificate_Get",
        Method:             "GET",
        PathPattern:        "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})",
        ProducesMediaTypes: []string{"application/json"},
        ConsumesMediaTypes: []string{"application/json; odata=minimalmetadata"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &CertificateGetReader{formats: a.formats},
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    return result.(*CertificateGetOK), nil

}

/*
CertificateList lists all of the certificates that have been added to the specified account
*/
func (a *Client) CertificateList(params *CertificateListParams) (*CertificateListOK, error) {
    // TODO: Validate the params before sending
    if params == nil {
        params = NewCertificateListParams()
    }

    result, err := a.transport.Submit(&runtime.ClientOperation{
        ID:                 "Certificate_List",
        Method:             "GET",
        PathPattern:        "/certificates",
        ProducesMediaTypes: []string{"application/json"},
        ConsumesMediaTypes: []string{"application/json; odata=minimalmetadata"},
        Schemes:            []string{"https"},
        Params:             params,
        Reader:             &CertificateListReader{formats: a.formats},
        Context:            params.Context,
        Client:             params.HTTPClient,
    })
    if err != nil {
        return nil, err
    }
    return result.(*CertificateListOK), nil

}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
    a.transport = transport
}