<commit_before>// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package lxdclient

import (
	"crypto/x509"

	"github.com/juju/errors"
	"github.com/lxc/lxd"
	"github.com/lxc/lxd/shared"
)

type rawClientServerMethods interface {
	WaitForSuccess(waitURL string) error

	SetServerConfig(key string, value string) (*lxd.Response, error)

	CertificateList() ([]shared.CertInfo, error)
	CertificateAdd(cert *x509.Certificate, name string) error
	CertificateRemove(fingerprint string) error
}

type clientServerMethods struct {
	raw rawServerMethods
}

func (c clientServerMethods) setUpRemote(cert *x509.Certificate, name string) error {
	resp, err := c.raw.SetServerConfig("core.https_address", "[::]")
	if err != nil {
		return errors.Trace(err)
	}
	if resp.Operation != "" {
		if err := c.raw.WaitForSuccess(resp.Operation); err != nil {
			// TODO(ericsnow) Handle different failures (from the async<commit_msg>Add a doc comment to clientServerMethods.<commit_after>// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package lxdclient

import (
	"crypto/x509"

	"github.com/juju/errors"
	"github.com/lxc/lxd"
	"github.com/lxc/lxd/shared"
)

type rawClientServerMethods interface {
	WaitForSuccess(waitURL string) error

	SetServerConfig(key string, value string) (*lxd.Response, error)

	CertificateList() ([]shared.CertInfo, error)
	CertificateAdd(cert *x509.Certificate, name string) error
	CertificateRemove(fingerprint string) error
}

// clientServerMethods implements the Client methods related
// to server operations.
type clientServerMethods struct {
	raw rawServerMethods
}

func (c clientServerMethods) setUpRemote(cert *x509.Certificate, name string) error {
	resp, err := c.raw.SetServerConfig("core.https_address", "[::]")
	if err != nil {
		return errors.Trace(err)
	}
	if resp.Operation != "" {
		if err := c.raw.WaitForSuccess(resp.Operation); err != nil {
			// TODO(ericsnow) Handle different failures (from the async
{'fraction_non_alphanumeric': 0.11572700296735905, 'fraction_numerical': 0.013847675568743818, 'mean_word_length': 4.967551622418879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1870239', 'n_tokens_mistral': 672, 'n_tokens_neox': 633, 'n_words': 171}